package cn.iocoder.yudao.module.wrdk.dal.mysql.grid;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wrdk.dal.dataobject.grid.wrdkgridDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wrdk.controller.admin.grid.vo.*;

/**
 * 地块坐标 Mapper
 *
 * @author Fan Kaixiang
 */
@Mapper
public interface wrdkgridMapper extends BaseMapperX<wrdkgridDO> {

    default PageResult<wrdkgridDO> selectPage(wrdkgridPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<wrdkgridDO>()
                .eqIfPresent(wrdkgridDO::getX, reqVO.getX())
                .eqIfPresent(wrdkgridDO::getY, reqVO.getY())
                .eqIfPresent(wrdkgridDO::getClassId, reqVO.getClassId())
                .eqIfPresent(wrdkgridDO::getLandId, reqVO.getLandId())
                .eqIfPresent(wrdkgridDO::getSn, reqVO.getSn())
                .orderByDesc(wrdkgridDO::getId));
    }

    default List<wrdkgridDO> selectList(wrdkgridExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<wrdkgridDO>()
                .eqIfPresent(wrdkgridDO::getX, reqVO.getX())
                .eqIfPresent(wrdkgridDO::getY, reqVO.getY())
                .eqIfPresent(wrdkgridDO::getClassId, reqVO.getClassId())
                .eqIfPresent(wrdkgridDO::getLandId, reqVO.getLandId())
                .eqIfPresent(wrdkgridDO::getSn, reqVO.getSn())
                .orderByDesc(wrdkgridDO::getId));
    }

}
